home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / internet-tools / connect-line / cl / rexx / cl-splitlog.clrexx < prev    next >
Encoding:
Text File  |  1996-02-05  |  3.0 KB  |  116 lines

  1. /*
  2. **  $VER: CL-SplitLog.clrexx 1.1 (05 Feb 1996)
  3. **
  4. **        © 1995-96 Ralf Ramge
  5. **
  6. **  PROGRAMNAME:
  7. **      CL-SplitLog.clrexx
  8. **
  9. **  FUNCTION:
  10. **      Demonstrationsskript zur cl_rexx.library, Connectline 5.0
  11. **
  12. **      Connectline © 1986-1995 Oliver Wagner, Mathias Mischler
  13. **      cl_rexx.library © 1995 Mathias Mischler
  14. **
  15. **      Dieses Skript splittet ein Logfile in mehrere Sublogs, eines pro LogID.
  16. **      Optional kann ein Pfad und Name eines zu bearbeitenden Logs als Parameter
  17. **      übergeben werden.
  18. **
  19. **      Notgedrungen arbeitet das Skript sehr zeitaufwendig, was durch ein paar
  20. **      Sicherheitsmaßnahmen noch verstärkt wird. Die einzelnen Files werden für
  21. **      jeden Eintrag geschlossen und wieder neu geöffnet, um im Falle eines Ab-
  22. **      sturzes oder Reset nicht für ewig lange Validate-Zeiten zu sorgen. Damit
  23. **      der Boxbetrieb durch den RexxMast nich unnötig gestört wird, läuft das
  24. **      Skript auf Priorität -2, was das Ganze natürlich nochmal verlangsamt.
  25. **      Falls man das Skript gerne einsetzen möchte, so empfehle ich, es täglich
  26. **      einmal per Cron zu starten, bevor die Logfiles eine wahnsinnige Größe er-
  27. **      reichen.
  28. **
  29. **  $HISTORY:
  30. **
  31. **   03 Dec 1995 : 0.01 : initial release
  32. **   05 Dec 1995 : 1.0  : Auf cl_rexx optimiert
  33. **   05 Feb 1996 : 1.1  : kosmetische Fixes
  34. */
  35.  
  36. file=arg(1)
  37.  
  38. /* cl_rexx.library öffnen */
  39.  
  40. if ~show('L','cl_rexx.library') then do
  41.     if ~addlib('cl_rexx.library',0,-30,0) then exit 10
  42.     end
  43.  
  44. /* rexxsupport.library öffnen */
  45.  
  46. if ~show('L','rexxsupport.library') then do
  47.     if ~addlib('rexxsupport.library',0,-30,0) then exit 10
  48.     end
  49.  
  50. /* Fontsize ermitteln */
  51.  
  52. gfxbase=showlist(l,'graphics.library',0,a)
  53. call forbid
  54. FontAddress=next(gfxbase,154)
  55. Fontsize=c2d(IMPORT(offset(FontAddress,20),2))
  56. call permit
  57. windowwidth=Fontsize*50
  58. windowheight=Fontsize*4
  59. windowY=Fontsize+1
  60. WindowX=Fontsize
  61.  
  62. /* Standard-IO umleiten */
  63.  
  64. screen=CLGET_FrontScreenName()
  65. call close STDOUT
  66. if ~open(STDOUT,'CON:'windowX'/'windowY'/'windowwidth'/'windowheight'/CL-SplitLog/SCREEN'screen,'W') then
  67.     exit 20
  68. else do
  69.     call close STDIN
  70.     call open STDIN,'*',R
  71.     call pragma '*'
  72.     end
  73.  
  74. if exists('CONNECTLINE:Log/Logfile-'||date()) then exit
  75.  
  76. if file='' then do
  77.     say 'Benenne Logfile um ...'
  78.     call CL_LogRename('CONNECTLINE:Log/Logfile-'||date())
  79.     file='CONNECTLINE:Log/Logfile-'||date()
  80.     end
  81.  
  82. if ~open('log',file,'R') then do
  83.     say 'Konnte Logfile nicht öffnen !'
  84. error:
  85.     exit 10
  86.     end
  87.  
  88. say 'Lese Logfile ...'
  89. anzahl=CL_GetText(file,zeile)
  90. say 'Splitte Logfile ...'
  91. do x=0 to anzahl-1
  92.     if word(zeile.x,1)='AB' then zeile.x=''
  93.     logid=word(zeile.x,3)
  94.     if zeile~='' then do
  95.         if exists('CONNECTLINE:Log/'logid'.LOG') then mode='A'
  96.         else mode='W'
  97.         if ~open(hndl,'CONNECTLINE:Log/'logid'.LOG',mode) then do
  98.             say 'Konnte Sublog 'logid' nicht öffnen !'
  99.             call error
  100.             end
  101.         call writeln hndl,zeile.x
  102.         end
  103.     call close hndl
  104.     end
  105.  
  106.  
  107.  
  108. ende:
  109.  
  110. call CL_LogAdd('0','SPLTLOG','Logfile gesplittet')
  111.  
  112. call close STDOUT
  113. call close STDIN
  114. exit
  115.  
  116.